package com.csu.cphone.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.csu.cphone.dao.PhoneBrandMapper;
import com.csu.cphone.pojo.PhoneBrandPojo;
import com.csu.cphone.service.PhoneBrandService;

/**
 * @项目名称：cphone
 * @类名称：PhoneBrandServiceImpl
 * @类描述：
 * @创建人：Tangc
 * @创建时间：2017年12月6日 上午8:51:58
 * @company:
 */
@Service
public class PhoneBrandServiceImpl implements PhoneBrandService
{

    @Autowired
    private PhoneBrandMapper phoneBrandMapper;

    /**
     * @see com.csu.cphone.service.PhoneBrandService#add(java.lang.String,
     *      java.lang.String)
     */
    @Override
    public PhoneBrandPojo add(String brandName, String picUrl)
    {
        PhoneBrandPojo phoneBrand = new PhoneBrandPojo();
        phoneBrand.setBrandName(brandName);
        phoneBrand.setPicUrl(picUrl);
        phoneBrandMapper.insert(phoneBrand);
        return phoneBrand;
    }

    /**
     * @see com.csu.cphone.service.PhoneBrandService#update(com.csu.cphone.pojo.PhoneBrandPojo)
     */
    @Override
    public Integer update(PhoneBrandPojo phoneBrand)
    {
        return phoneBrandMapper.update(phoneBrand);
    }

    /**
     * @see com.csu.cphone.service.PhoneBrandService#queryById(java.lang.Integer)
     */
    @Override
    public PhoneBrandPojo queryById(Integer phoneBrandId)
    {
        return phoneBrandMapper.selectById(phoneBrandId);
    }

    /**
     * @see com.csu.cphone.service.PhoneBrandService#count()
     */
    @Override
    public Integer count()
    {
        return phoneBrandMapper.count();
    }

    /**
     * @see com.csu.cphone.service.PhoneBrandService#queryList(java.lang.Integer,
     *      java.lang.Integer, java.lang.String)
     */
    @Override
    public List<PhoneBrandPojo> queryList(Integer pageSize, Integer startIndex, String order)
    {

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("pageSize", pageSize);
        map.put("startIndex", startIndex);
        map.put("order", order);
        return phoneBrandMapper.queryList(map);
    }

    /**
     * @see com.csu.cphone.service.PhoneBrandService#deleteById(java.lang.Integer)
     */
    @Override
    public Integer deleteById(Integer phoneBrandId)
    {
        return phoneBrandMapper.deleteById(phoneBrandId);
    }

}
